package file;

import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;

public class FileWriterTest {
	
	public static void main(String[] args) throws IOException {
		
		File f = new File("C:\\java-master\\diary.txt");
		
		if (!f.exists()) {
			f.createNewFile();
		}
		
		FileWriter writer = new FileWriter(f);
		
		writer.write('H');
		writer.write('e');
		writer.write('l');
		writer.write('l');
		writer.write('o');
		writer.write('\r');	// CR
		writer.write('\n');	// LF
		writer.write("날씨 맑음.");
		
		writer.close();
		
//		FileOutputStream out = new FileOutputStream(f);
//		out.write('H');
//		out.write('e');
//		out.write('l');
//		out.write('l');
//		out.write('o');
//		out.write('\r');
//		out.write('\n');
//		out.write('날');	// out.write(45216);
//		out.write('씨');
//		out.write(' ');
//		out.write('맑');
//		out.write('음');
//		out.write('.');
//		
//		out.close();
		
//		System.out.println((int)'날');
		
		System.out.println("일기 쓰기 완료");
		
	}
	
}
